<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head></h:head>
<body>
	<h:form id="creazionePacchetto">
		<p:panel header="Creazione nuovo pacchetto">
			<h:panelGrid columns="3">				
				<h:outputLabel for="nome" value="Nome:" style="font-weight:bold"/>  
	          	<p:inputText id="nome" value="#{pacchettoBean.p.nome}"/>
	          	<p:message for="nome" />
	          	
	          	<h:outputLabel for="descrizione" value="Descrizione:" style="font-weight:bold"/>  
	          	<p:inputText id="descrizione" value="#{pacchettoBean.p.descrizione}" />
	          	<p:message for="descrizione" />
	          	
	          	<h:outputLabel for="sconto" value="Sconto:" style="font-weight:bold"/>  
	          	<p:inputText id="sconto" value="#{pacchettoBean.p.sconto}" />
	          	<p:message for="sconto" />
          	</h:panelGrid>
        </p:panel>
       	<p:panel header="Ricerca prodotti">
     	  	<p:panelGrid id="gridOptionSearch">
     	  		<f:facet name="header">
     	  			<p:row>  
       				<p:column>Data andata</p:column>
       				<p:column>Data ritorno</p:column>
       				<p:column>Destinazione</p:column>
       				</p:row>
       			</f:facet> 
	          		<p:row>
          	      	<p:column headerText="Partenza">
			       		<p:calendar value="#{pacchettoBean.p.dataInizio}" pattern="dd/MM/yyyy" mindate="#{pacchettoBean.today}">
			       			<p:ajax event="dateSelect" update="gridOptionSearch" />
			       		</p:calendar>
					</p:column>
		
					<p:column headerText="Arrivo">
						<p:calendar value="#{pacchettoBean.p.dataFine}" pattern="dd/MM/yyyy" mindate="#{pacchettoBean.p.dataInizio}"/>
					</p:column>
		
					<p:column headerText="Citta arrivo">
						<p:inputText value="#{pacchettoBean.cittaArrivo}" />
					</p:column>
					</p:row>
			</p:panelGrid>
		</p:panel>
	          	
       	<h:commandButton value="Cerca" action="#{pacchettoBean.cerca()}" update="productLists" />
	          	
       	<p:panel header="Seleziona un prodotto per lista">
       	  	<h:panelGrid columns="1" id="productLists">
       	  		<p:dataTable margin="20px" id="tableescursioni" var="escursioniDTO" value="#{pacchettoBean.listEscursione}" 
       	  		    selection="#{pacchettoBean.escursioneSelected}" rowKey="#{escursioniDTO.id}">

					<f:facet name="header">  
        				Lista di escursioni  
   	    			</f:facet>   
      		
					<p:column selectionMode="single" />
					
	   		        <p:column headerText="Data Inizio">  
			            <h:outputText value="#{escursioniDTO.dataInizio}" />  
			        </p:column>  
			  
			        <p:column headerText="Data Fine">  
			            <h:outputText value="#{escursioniDTO.dataFine}" />  
			        </p:column>
			        
			        <p:column headerText="Numero posti">  
			            <h:outputText value="#{escursioniDTO.nposti}" />  
			        </p:column>
			        
			        <p:column headerText="Prezzo">  
			            <h:outputText value="#{escursioniDTO.prezzo}" />  
			        </p:column> 
			        
			        <p:column headerText="Città">  
			            <h:outputText value="#{escursioniDTO.citta}" />  
			        </p:column>
			        
			        <p:column headerText="Ora di Inizio">  
			            <h:outputText value="#{escursioniDTO.oraInizio}" />  
			        </p:column>
        		</p:dataTable>  
  		
	    		<p:dataTable margin="20px" id="tablehotel" var="hotelDTO" value="#{pacchettoBean.listHotel}" 
	       	  		selection="#{pacchettoBean.hotelSelected}" rowKey="#{hotelDTO.id}">   
	    			<f:facet name="header">  
	            		Lista di hotel  
	       		    </f:facet>   
	        		
	        		<p:column selectionMode="single" />  
	        		
	      		    <p:column headerText="Data Inizio">  
			            <h:outputText value="#{hotelDTO.dataInizio}" />  
			        </p:column>  
			  
			        <p:column headerText="Data Fine">  
			            <h:outputText value="#{hotelDTO.dataFine}" />  
			        </p:column>
			        
			        <p:column headerText="Numero di posti">  
			            <h:outputText value="#{hotelDTO.nposti}" />  
			        </p:column>
			        
			        <p:column headerText="Prezzo">
			        	<h:outputText value="#{hotelDTO.prezzo}" /> 
			        </p:column>
			        
			        <p:column headerText="Città">  
			            <h:outputText value="#{hotelDTO.citta}" />  
			        </p:column>
			        
			        <p:column headerText="Nome">  
			            <h:outputText value="#{hotelDTO.nome}" />  
			        </p:column>
			        
			        <p:column headerText="Stelle">  
			            <h:outputText value="#{hotelDTO.stelle}" />  
			        </p:column>
	    		</p:dataTable>  
	  		
  				<p:dataTable margin="20px" id="tablevoli" var="voloDTO" value="#{pacchettoBean.listVoli}" 
	       	  		selection="#{pacchettoBean.voloSelected}" rowKey="#{voloDTO.id}" >  
	    			<f:facet name="header">  
	            		Lista di voli  
	       		    </f:facet>   
	        		
	        		<p:column selectionMode="single" />
	        		
	       	        <p:column headerText="Data Inizio">  
			            <h:outputText value="#{voloDTO.dataInizio}" />  
			        </p:column>  
			  
			        <p:column headerText="Data Fine">  
			            <h:outputText value="#{voloDTO.dataFine}" />  
			        </p:column>  
	        
			        <p:column headerText="Numero di posti">  
			            <h:outputText value="#{voloDTO.nposti}" />  
			        </p:column> 
			        
			        <p:column headerText="Prezzo">  
			            <h:outputText value="#{voloDTO.prezzo}" />  
			        </p:column> 
			        
			        <p:column headerText="Partenza">  
			            <h:outputText value="#{voloDTO.citta_partenza}" />  
			        </p:column>  
			        
			        <p:column headerText="Arrivo">  
			            <h:outputText value="#{voloDTO.citta_arrivo}" />  
			        </p:column>  
			        
			        <p:column headerText="Compagnia">  
			            <h:outputText value="#{voloDTO.compagnia}" />  
			        </p:column>  
			        
			        <p:column headerText="Aereo">  
			            <h:outputText value="#{voloDTO.aereo}" />  
			        </p:column>  
	       		</p:dataTable>
			</h:panelGrid>
		</p:panel>
 		    
		<h:commandButton value="Crea" action="#{pacchettoBean.creaPacchetto()}" update="creazionePacchetto" />
	    <h:commandButton value="Annulla" action="#{pacchettoBean.annullaCreazione()}" />
	         	
	    <h:outputLabel value="#{pacchettoBean.errore}" style="font-weight:bold" />
	</h:form>
</body>
</html>